package org.restql.db.resource;

import java.sql.Connection;
import java.sql.SQLException;

import javax.sql.DataSource;

/**
 * Singleton that returns a new Connection object given an individual
 * request object.
 */
public interface DatabaseResource {

	public void setDataSource(DataSource dataSource);

	public String getSelectString(RequestResource requestResource);
	public String getFromString(RequestResource requestResource);
	public String getWhereString(RequestResource requestResource);

	public void setDbName(String dbName);
	public String getDbName();

	public void setResourceName(String resourceName);
	public String getResourceName();

	public Connection getConnection(RequestResource requestResource) throws SQLException;

	public boolean allowSelect();
	public boolean allowUpdate();
	public boolean allowInsert();
	public boolean allowDelete();
}
